package com.zz.common.model

import java.util.concurrent.TimeUnit

import com.typesafe.config.ConfigFactory

import scala.concurrent.duration.FiniteDuration

/**
  * @author huanggh
  *         19-8-16 上午11:39
  */
object Config {
  def apply(config:com.typesafe.config.Config = ConfigFactory.load().getConfig("kafka.dsp-id-mapping")) =
    new Config(
      topicIn = config.getString("topic-in")
      , groupId = config.getString("group-id")
      , batchSize = config.getInt("batch-size")
      , batchTimeWindow = FiniteDuration(config.getDuration("batch-time-window").toMillis, TimeUnit.MILLISECONDS)
      , maxPartitions = config.getInt("max-partitions")
    )
}

case class Config(
  topicIn: String,
  groupId: String,
  batchSize: Int,
  batchTimeWindow: FiniteDuration,
  maxPartitions: Int
)

